<template>
  <div class="">      
        <el-table :data="tableData" border style="width: 100%" header-row-class-name="bgd8">
                    
                    <el-table-column  label="序号" type="index" > </el-table-column>
                    <el-table-column prop="projectName" label="项目名称" :show-overflow-tooltip="true"> </el-table-column>
                    <el-table-column prop="name" label="反馈人姓名" :show-overflow-tooltip="true"> </el-table-column>
                    <el-table-column prop="phone" label="联系电话" :show-overflow-tooltip="true"> </el-table-column>
                    <el-table-column prop="email" label="邮箱" :show-overflow-tooltip="true"> </el-table-column>
                    <el-table-column prop="content" label="反馈内容" :show-overflow-tooltip="true"> </el-table-column>
                    <el-table-column prop="createTime" label="创建日期"> 
                        <template slot-scope="scope">
                               <span>{{scope.row.createTime|formatDate}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column label="操作 ">
                        <template slot-scope="scope">
                            <el-button type="danger" size="small"  @click="del(scope.row)">删除</el-button>
                        </template>
                    </el-table-column>
        </el-table>
         <el-pagination background  layout="prev, pager, next" :total="totalCount" @current-change="currentChange" @prev-click="prevClick" @next-click="nextClick"> </el-pagination>   
  </div>
</template>

<script>
// import ueditor from './ue.vue' //调用编辑器
export default {
  name: 'HelloWorld',
  data () {
    return {
      tableData: [{}],
      curPage:1,
      totalCount:0,
      formData:{
          name:''
        }
    }
  },
  filters:{
    formatDate(date){
      date=new Date(date);
      var year=date.getFullYear();
      var month=date.getMonth()+1;
      var day=date.getDate();
      if(month<10){
        month='0'+month;
      }
      return year+'-'+month+'-'+day;
    }
  },
  methods:{     
      del(data){
        this.$confirm('确定要删除吗?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          var id =data.id;
          var httpApi=this.$store.state.httpApi;
          this.$http.post(this.$store.state.httpApi + 'afterSaleServiceSheet/del?id='+id).then(response =>{
            if(response.status == 200){
              this.$message.success('删除成功');
					    this.getRows();
            }else{
              console.log('接口返回失败!',response);
            }
          },response => {
            
            console.log('请求失败',response)
          })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          });          
        });
      },
       currentChange(page){
          this.curPage = page;
          this.getRows();
      },
      //上一页
      prevClick(page){
          this.curPage = page;
          this.getRows();
      },
    //  下一页
      nextClick(page){
          this.curPage = page;
          this.getRows();
      },
       getRows(){
          this.$http.get(this.$store.state.httpApi + 'afterSaleServiceSheet/page?currentPage='+this.curPage+'&pageNumber='+10).then(response =>{
          if(response.status == 200){
          this.tableData=response.data.data.pp;
          this.totalCount = response.data.data.page.totalPage*10;
          }else{
            console.log('接口返回失败!',response);
          }
          },response => {
            console.log('请求失败',response)
          })
       }
      
  },
   created(){
    this.getRows();
  },
  computed: {
  },
  components: {
//使用编辑器
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="less" scoped>
    .panel{
      display:inline-block;
      position: relative;
      left: 50%;
      transform: translateX(-50%);
    }
    .block{
      display:block;
      margin-left:0;
      margin-bottom: 10px;
    }
    .img{
        height:513px;
        width:917px;
        display:block;
        margin-bottom:20px;
    }
    .imglist{
        font-size:0;
    }
     .imglist li{
        width:100px;
        height:100px;
        display:inline-block;
        vertical-align: top;
        margin-right:10px;
        position:relative;
    }
    .imglist li img{
        width:100%;
        height:100%;
    }
     .upload{
        width:100%;
        height: 100%;
        box-sizing: border-box;
        border:1px solid #D9D9D9;
        font-size: 54px;
        text-align: center;
        // line-height: 200px;
        color: #D2D2D2;
        line-height:100px;
    }
    .upload img{
        width:100%;
        height: 100%;
    }
</style>
